<?php
$username =$_REQUEST["username"];
$password =$_REQUEST["password"];
$telephone =$_REQUEST["telephone"];
$name =$_REQUEST["name"];
$age =$_REQUEST["age"];
$sex =$_REQUEST["sex"];
$address =$_REQUEST["address"];
$signature =$_REQUEST["signature"];
$identity =$_REQUEST["identity"];
$modTime =$_REQUEST["time"];

//用户名
if ($username!=" ") {

  addMessage();
};
function addMessage(){
  global $username,$identity;
  // $username =$_REQUEST["username"];
  // $identity =$_REQUEST["identity"];
  $mysql =new mysqli("localhost","root","","pengdandan");
  $mysql->query("set names utf8");
  session_start();
  $_SESSION['username']=$username;
  $sql ="UPDATE heibing SET username = '$username' WHERE id ='$identity'";
  $result=$mysql->query($sql);
  if ($result) {

  }else {
    echo "修改失败";
  }
};
//密码
if ($password!="") {
  add_password();
};
function add_password(){
    global $password,$identity;
  $mysql1 =new mysqli("localhost","root","","pengdandan");
  $mysql1->query("set names utf8");
  session_start();
  $_SESSION['password']=$password;
  $sql1 ="UPDATE heibing SET password = '$password' WHERE id ='$identity'";

  $result1=$mysql1->query($sql1);
  if ($result1) {

  }else {
    echo "修改失败";
  }
};

//电话号码

if ($telephone!="") {
  add_telephone();
};
function add_telephone(){
  global $telephone, $identity;
  $mysql2 =new mysqli("localhost","root","","pengdandan");
  $mysql2->query("set names utf8");
  $sql2 ="UPDATE heibing SET telephone = '$telephone' WHERE id ='$identity'";

  $result2=$mysql2->query($sql2);
  if ($result2) {

  }else {
    echo "修改失败";
  }
};

//姓名

if ($name!="") {
  add_name();
};
function add_name(){
  global $name, $identity;
  $mysql3 =new mysqli("localhost","root","","pengdandan");
  $mysql3->query("set names utf8");
  $sql3 ="UPDATE heibing SET name = '$name' WHERE id ='$identity'";

  $result3=$mysql3->query($sql3);
  if ($result3) {

  }else {
    echo "修改失败";
  }
};


//年龄

if ($age!="") {
  add_age();
};
function add_age(){
  global $age, $identity;
  $mysql4 =new mysqli("localhost","root","","pengdandan");
  $mysql4->query("set names utf8");
  $sql4 ="UPDATE heibing SET age = '$age' WHERE id ='$identity'";

  $result4=$mysql4->query($sql4);
  if ($result4) {

  }else {
    echo "修改失败";
  }
};

//性别

if ($sex!="") {
  add_sex();
};
function add_sex(){
  global $sex, $identity;
  $mysql5 =new mysqli("localhost","root","","pengdandan");
  $mysql5->query("set names utf8");
  $sql5 ="UPDATE heibing SET sex = '$sex' WHERE id ='$identity'";

  $result5=$mysql5->query($sql5);
  if ($result5) {

  }else {
    echo "修改失败";
  }
};
//住址

if ($address!="") {
  add_address();
};
function add_address(){
  global $address, $identity;
  $mysql6 =new mysqli("localhost","root","","pengdandan");
  $mysql6->query("set names utf8");
  $sql6 ="UPDATE heibing SET address = '$address' WHERE id ='$identity'";

  $result6=$mysql6->query($sql6);
  if ($result6) {

  }else {
    echo "修改失败";
  }
};

//个人签名

if ($signature!="") {
  add_signature();
};
function add_signature(){
    global $signature, $identity;
  $mysql7 =new mysqli("localhost","root","","pengdandan");
  $mysql7->query("set names utf8");
  $sql7 ="UPDATE heibing SET signature = '$signature' WHERE id ='$identity'";

  $result7=$mysql7->query($sql7);
  if ($result7) {

  }else {
    echo "修改失败";
  }
};

//修改时间

if ($modTime!="") {
  add_modTime();
};
function add_modTime(){
    global $modTime, $identity;
  $mysql8 =new mysqli("localhost","root","","pengdandan");
  $mysql8->query("set names utf8");
  $sql8 ="UPDATE heibing SET modTime = '$modTime' WHERE id ='$identity'";

  $result8=$mysql8->query($sql8);
  if ($result8) {

  }else {
    echo "修改失败";
  }
};

 ?>
